home *** CD-ROM | disk | FTP | other *** search
- package de.trantor.mail.j2me;
-
- import de.trantor.mail.Connection;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import javax.microedition.io.Connector;
- import javax.microedition.io.StreamConnection;
-
- public class ConnectionImpl extends Connection {
- private StreamConnection socket;
-
- public void open(String host, int port) throws IOException {
- this.socket = (StreamConnection)Connector.open("socket://" + host + ":" + port);
- }
-
- public void close() throws IOException {
- if (this.socket != null) {
- this.socket.close();
- this.socket = null;
- }
-
- }
-
- public InputStream getInputStream() throws IOException {
- return this.socket != null ? this.socket.openInputStream() : null;
- }
-
- public OutputStream getOutputStream() throws IOException {
- return this.socket != null ? this.socket.openOutputStream() : null;
- }
- }
-